const path = require("path")
const VueLoaderPlugin = require("vue-loader/lib/plugin")
const HtmlWebpackPlugin = require("html-webpack-plugin")
const CopyWebpackPlugin = require("copy-webpack-plugin")


module.exports = {
    mode: "none",
    entry: "./src/main.js",
    output: {
        filename: "[name]-[chunkhash:8].bundle.js",
        path: path.join(__dirname, "dist")
    },
    module: {
        rules: [{
                test: /\.js$/,
                use: 'babel-loader',
                exclude: /node_modules/
            },
            {
                test: /\.less$/,
                use: ["style-loader", "css-loader", {
                    loader: "less-loader",
                    options: {
                        lessOptions: {
                            strictMath: true
                        }
                    }
                }]
            },
            {
                test: /\.vue$/,
                loader: 'vue-loader'
            },
            {
                test: /\.(png|jpeg|jpg)$/,
                use: [
                    {
                       loader: 'url-loader',
                       options: {
                           limit: 10 * 1024
                       } 
                    }
                ]
            }
        ]
    },
    plugins: [
        new VueLoaderPlugin(),
        new HtmlWebpackPlugin({
            base: "/",
            title: "vue-app-base",
            filename: "index.html",
            template: './public/index.html'
        }),
        new CopyWebpackPlugin({
            patterns: {
                from: "public"
            }
        })
    ]
}